home *** CD-ROM | disk | FTP | other *** search
/ Pascal Super Library / Pascal Super Library (CW International)(1997).bin / MATH / NRPAS13 / MDIAN1.DEM < prev    next >
Text File  |  1991-04-29  |  901b  |  44 lines

  1. PROGRAM d13r1(input,output);
  2. (* driver for routine MDIAN1 *)
  3. CONST
  4.    npts=50;
  5. TYPE
  6.    glsarray = ARRAY [1..npts] OF real;
  7.    narray = glsarray;
  8. VAR
  9.    glinext,glinextp : integer;
  10.    glma : ARRAY [1..55] OF real;
  11.    gliset : integer;
  12.    glgset : real;
  13.    i,j,idum : integer;
  14.    xmed : real;
  15.    data : glsarray;
  16.  
  17. (*$I MODFILE.PAS *)
  18. (*$I RAN3.PAS *)
  19.  
  20. (*$I GASDEV.PAS *)
  21.  
  22. (*$I SORT.PAS *)
  23.  
  24. (*$I MDIAN1.PAS *)
  25.  
  26. BEGIN
  27.    gliset := 0;
  28.    idum := -5;
  29.    FOR i := 1 to npts DO BEGIN
  30.       data[i] := gasdev(idum)
  31.    END;
  32.    mdian1(data,npts,xmed);
  33.    writeln('Data drawn from a gaussian distribution');
  34.    writeln('with zero mean and unit variance');
  35.    writeln;
  36.    writeln('Median of data set is',xmed:9:6);
  37.    writeln;
  38.    writeln('Sorted data');
  39.    FOR i := 1 to (npts DIV 5) DO BEGIN
  40.       FOR j := 1 to 5 DO write(data[5*i-5+j]:12:6);
  41.       writeln
  42.    END
  43. END.
  44.